Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

299
Visualizações
How to get file content witn Ajax - "Undefined" returned

I have the html/jquery code shown below. When open the page I get an alert "Undefined" followed by the alert "Error - pcsdBase" from the ajax 'error' function. The "undefined" seems to come from the jquery library ....

// Main method
    ajax: function( url, options ) {

        // If url is an object, simulate pre-1.5 signature
        if ( typeof url === "object" ) {
            options = url;
            url = undefined;
        }

at line 9375 in this library

My code is

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>PhotoCompSoftware documentation</title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.0.js"></script>
    <script type="text/javascript">
        function getText() {
            $.ajax({
                type: 'GET',
                url: 'http://photocomp.uk/pcs-help/pcsdBase.html',
                dataType: 'text',
                success: function (txt, textStatus) {
                    alert('text=' + txt)
                    return txt;
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert('Error - ' + section + '.html');
                 }
            })
        }
 
        $(document).ready(function() {
            alert(getText());
         })
    </script>
</head>
<body>
   <p>Alert should say From file</p>
</body>
</html>

What am I doing wrong?

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda